#include("./layout.html")
#include("_sidebar.html")
#include("_include.html")

#@layout()

#define script()
#@sidebarResource()
#end

#define css()
#@articleSearchIncludeCss()
#end

#define content()
<div class="col-md-8 col-lg-8 col-xl-9 #(option('whimurmur_sidebar_position') == 'left' ? 'offset-md-4 offset-lg-4 offset-xl-3 cl-right' : 'cl-left')">
     #articleSearchPage(pageSize=15, hiddenFlag=true)
        #if(articlePage && articlePage.list && articlePage.list.size() > 0)
            #for(article : articlePage.list)
            <div class="cl-card bg-light">
                <a class="card-link" href="#(article.url)" target="#(option('whimurmur_link_to_blank') && article.linkTo ? '_blank' : '_self')">
                    <div class="row">
                        <div class="col-lg-3 col-md-4 col-sm-12 cl-card-image">
                            <img src="#(article.thumbnail ? article.thumbnail : (article.showImage ? article.showImage : 'img/default-img.png'))" class="img-fluid" alt="">
                        </div>
        
                        <div class="col-lg-9 col-md-8 col-sm-12 cl-card-main">
                            <h3 class="cl-card-main-title">
                               #(article.title)
                            </h3>
                            <p class="cl-card-main-info">#maxLength(article.text,100)</p>
                            <p class="cl-card-more">#(article.user.nickname ??) 发布于 #date(article.created ?? article.modified, "yyyy年MM月dd日 HH时")
                            &nbsp;|&nbsp;
                            #articleCategories(article.getId(), 'category')
                                分类：
                                #for(category: categories)
                                    #(category.title ??)
                                #end
                            #end
                            &nbsp;|&nbsp;
                            #articleCategories(article.getId(), 'tag')
                                标签：
                                #for(category: categories)
                                    #(category.title ??)
                                    #if(for.size != for.count)
                                        &nbsp;/&nbsp;
                                    #end
                                #end
                            #end
                            </p>
                        </div>
                    </div>
                </a>
            </div>
            
            #if(for.count==1 && option('whimurmur_list_ad_1' ??))
            <div class="cl-card card-link">
                <div class="row">
                    <div class="col-lg-12 col-md-12 col-sm-12 cl-card-main bg-light">
                        <div class="list-1-ad" id="list-1-ad">
                            <div class="list-1-ad-main">
                                <div id="list-1-ad-content" class="m-1 ad-content">
                                    #option("whimurmur_list_ad_1" ??)
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            #else if(for.count==5 && option('whimurmur_list_ad_2' ??))
                <div class="cl-card card-link">
                    <div class="row">
                        <div class="col-lg-12 col-md-12 col-sm-12 cl-card-main bg-light">
                            <div class="list-2-ad bg-light" id="list-2-ad">
                                <div class="list-2-ad-main">
                                    <div id="list-2-ad-content" class="m-1 ad-content">
                                        #option("whimurmur_list_ad_2" ??)
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            #else if(for.count==10 && option('whimurmur_list_ad_3' ??))
                <div class="cl-card card-link">
                    <div class="row">
                        <div class="col-lg-12 col-md-12 col-sm-12 cl-card-main bg-light">
                            <div class="list-3-ad bg-light" id="list-3-ad">
                                <div class="list-3-ad-main">
                                    <div id="list-3-ad-content" class="m-1 ad-content">
                                        #option("whimurmur_list_ad_3" ??)
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            #end
            #end

            #articleSearchPaginate(firstGotoIndex=false)
            <nav aria-label="">
                <ul class="pagination justify-content-center">
                    #for(page : pages)
                    <li class="page-item #(page.style)"><a class="page-link" href="#(page.url ??)">#(page.text)</a></li>
                    #end
                </ul>
            </nav>
            #end
        #else
		<div class="card">
		  <div class="card-body">
			<h4 class="card-title">搜索结果为空</h4>
			<p class="card-text"><i class="fa fa-warning" aria-hidden="true"></i> 没有"#(keyword)"相关文章，换一个关键词试试吧</p>
	      </div>
	    </div>
	    #end
    #end

</div>

<div class="col-md-4 col-lg-4 col-xl-3 #(option('whimurmur_sidebar_position') == 'left' ? 'offset-mdn-8 offset-lgn-8 offset-xln-9 offset-smn-0 cl-left' : 'cl-right')">
    #@sidebarContent()
</div>
#end